import { defineConfig } from 'vitepress'

// https://vitepress.dev/reference/site-config
export default defineConfig({
  // 主题配置
  appearance: true, // 启用深色模式切换
  lastUpdated: true, // 显示最后更新时间
  title: '前端文档',
  description: '前端项目文档',

  // 使用 vite 字段配置开发服务器
  vite: {
    server: {
      port: 5174, // 文档服务器端口
      strictPort: true, // 禁止自动切换端口
    },
  },

  themeConfig: {
    nav: [
      { text: '首页', link: '/' },
      { text: '指南', link: '/guide/' },
      { text: '组件', link: '/components/' },
      { text: '视图', link: '/views/' },
      { text: 'TypeScript', link: '/typescript-docs/' },
      { text: 'Vue组件', link: '/vue-component-docs/' },
      { text: '文档系统', link: '/vitepress-docs/' },
    ],

    sidebar: {
      '/guide/': [
        {
          text: '指南',
          items: [{ text: '快速开始', link: '/guide/' }],
        },
      ],

      '/components/': [
        {
          text: '组件文档',
          items: [
            { text: '组件总览', link: '/components/' },
            {
              text: '基础组件',
              items: [
                { text: 'ButtonOptions', link: '/components/base/button/' },
                { text: 'IconFunction', link: '/components/base/icon/' },
                { text: 'HelloWorld', link: '/components/hello-world/' },
              ],
            },
            {
              text: '复合组件',
              items: [
                { text: 'CardComposition', link: '/components/composite/card/' },
                { text: 'UserList', link: '/components/composite/user-list/' },
                { text: 'DynamicTabs', link: '/components/dynamic-tabs' },
                { text: 'ListSetup', link: '/components/list-setup' },
              ],
            },
          ],
        },
      ],

      '/views/': [
        {
          text: '视图文档',
          items: [
            { text: '视图索引', link: '/views/' },
            { text: 'HomeView', link: '/views/home/' },
          ],
        },
      ],

      '/typescript-docs/': [
        {
          text: 'TypeScript文档',
          items: [{ text: 'TypeScript指南', link: '/typescript-docs/' }],
        },
      ],

      '/vue-component-docs/': [
        {
          text: 'Vue组件文档',
          items: [{ text: 'Vue组件指南', link: '/vue-component-docs/' }],
        },
      ],

      '/vitepress-docs/': [
        {
          text: '文档系统',
          items: [{ text: '文档系统指南', link: '/vitepress-docs/' }],
        },
      ],
    },
  },
})